package ru.spb.osll.myfit.wikiverifier.result;

import java.util.LinkedList;
import java.util.List;

import ru.spb.osll.myfit.util.CollectionUtils;
import ru.spb.osll.myfit.util.Pair;
import ru.spb.osll.myfit.wikiverifier.resulthandler.PageVerificationResultHandler;

public class AggregatedVerificationResult implements PageVerificationResultHandler {
	private int m_countPages;
	private int m_countFailures;
	private int m_countErrors;
	private List<Pair<String, PageVerificationResult>> m_pageResults;

	public AggregatedVerificationResult() {
		m_pageResults = new LinkedList<Pair<String, PageVerificationResult>>();
		m_countPages = 0;
		m_countFailures = 0;
		m_countErrors = 0;
	}

	@Override
	public void handleResult(String pagePath, PageVerificationResult pageResult) {
		m_pageResults.add(CollectionUtils.makePair(pagePath, pageResult));
		m_countPages++;
		if(pageResult.getResult() == VerificationResultType.FAILURE){
			m_countFailures++;
		} else if(pageResult.getResult() == VerificationResultType.ERROR){
			m_countErrors++;
		}
	}

	public int getCountPages() {
		return m_countPages;
	}

	public int getCountFailures() {
		return m_countFailures;
	}

	public int getCountErrors() {
		return m_countErrors;
	}
}
